package com.cykj.pos.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import org.apache.commons.lang3.StringUtils;
import com.cykj.pos.mapper.BizAgentOpenAccountMapper;
import com.cykj.pos.domain.BizAgentOpenAccount;
import com.cykj.pos.service.IBizAgentOpenAccountService;

import java.util.List;
import java.util.Map;

/**
 * 代理开户套餐Service业务层处理
 *
 * @author luo
 * @date 2021-08-31
 */
@Service
public class BizAgentOpenAccountServiceImpl extends ServiceImpl<BizAgentOpenAccountMapper, BizAgentOpenAccount> implements IBizAgentOpenAccountService {
    @Autowired
    BizAgentOpenAccountMapper bizAgentOpenAccountMapper;
    @Override
    public List<BizAgentOpenAccount> queryList(BizAgentOpenAccount bizAgentOpenAccount) {
        LambdaQueryWrapper<BizAgentOpenAccount> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(bizAgentOpenAccount.getRatet0())){
            lqw.eq(BizAgentOpenAccount::getRatet0 ,bizAgentOpenAccount.getRatet0());
        }
        if (StringUtils.isNotBlank(bizAgentOpenAccount.getQrsettleRate())){
            lqw.eq(BizAgentOpenAccount::getQrsettleRate ,bizAgentOpenAccount.getQrsettleRate());
        }
        if (StringUtils.isNotBlank(bizAgentOpenAccount.getParentUserId())){
            lqw.eq(BizAgentOpenAccount::getParentUserId ,bizAgentOpenAccount.getParentUserId());
        }
        if (StringUtils.isNotBlank(bizAgentOpenAccount.getCreationTime())){
            lqw.eq(BizAgentOpenAccount::getCreationTime ,bizAgentOpenAccount.getCreationTime());
        }
        return this.list(lqw);
    }
    @Override
    public int selectaccount(String uuid) {
        int bizMerchants=bizAgentOpenAccountMapper.selectaccount(uuid);
        return bizMerchants;
    }

    @Override
    public Long selectDeptId(String invitorCode) {
        Long deptIdParent=bizAgentOpenAccountMapper.selectDeptId(invitorCode);
        return deptIdParent;
    }
    @Override
    public BizAgentOpenAccount selectBizAgentOpenAccount(Long accountId) {
        BizAgentOpenAccount bizAgentOpenAccount=bizAgentOpenAccountMapper.selectBizAgentOpenAccount(accountId);
        return bizAgentOpenAccount;
    }
}
